# define _CRT_SECURE_NO_WARNINGS 1
#include"heap.h"

//int main()
//{
//	int a[] = { 50,100,70,65,60,32 };
//
//	Hp hp;
//	int n = sizeof(a) / sizeof(int);
//	//HeapCreate(&hp, a, n);
//	//for (int i = 0; i < sizeof(a) / sizeof(int); i++)
//	//{
//	//	HeapCreate(&hp, a[i],n);
//	//	//HeapInsert(&hp, i);
//	//}
//
//	//while (!HeapEmpty(&hp))
//	//{
//	//	printf("%d\n", HeapTop(&hp));
//	//	HeapPop(&hp);
//	//}
//	HeapDestroy(&hp);
//	return 0;
//}


int main()
{
    HPDataType a[] = { 1, 3, 5, 7, 9, 2, 4, 6, 8, 10 };
    int n = sizeof(a) / sizeof(a[0]);

    Hp hp;
    HeapCreate(&hp, a, n);

    printf("Heap Size: %d\n", HeapSize(&hp));
    printf("Heap Top: %d\n", HeapTop(&hp));

    HeapPush(&hp, 11);
    printf("Heap Size: %d\n", HeapSize(&hp));
    printf("Heap Top: %d\n", HeapTop(&hp));

    HeapPop(&hp);
    printf("Heap Size: %d\n", HeapSize(&hp));
    printf("Heap Top: %d\n", HeapTop(&hp));

    while (!HeapEmpty(&hp))
        {
       	    printf("%d\n", HeapTop(&hp));
        	HeapPop(&hp);
        }
    HeapDestroy(&hp);

    return 0;
}